package com.xukai.springboot.controller.article;

import com.xukai.springboot.entity.article.t_a_type;
import com.xukai.springboot.entity.request.article.DelArtileTypeRequest;
import com.xukai.springboot.entity.response.ResponseBase;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(basePath = "api/article/type", description = "文章分类管理")
@RestController
@RequestMapping("api/article/type/*")
public class ArticleTypeController {

    /**
     * 日志
     */
    private final Logger logger = LoggerFactory.getLogger(ArticleTypeController.class);

    /**
     * 获取文章分类列表
     */
    @ApiOperation(value = "获取文章分类列表", notes = "获取文章分类列表")
    @ApiImplicitParams({

    })
    @GetMapping("GetTypeList")
    public ResponseBase<List<t_a_type>> GetTypeList() {
        ResponseBase<List<t_a_type>> result = new ResponseBase<>();
        try {
        } catch (Exception e) {
            logger.error("获取文章分类列表", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 新建文章分类
     */
    @ApiOperation(value = "新建文章分类", notes = "新建文章分类")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Param", value = "文章分类信息", required = true, dataType = "t_a_type", paramType = "body")
    })
    @PostMapping("CreateType")
    public ResponseBase<t_a_type> CreateType(@RequestBody t_a_type Param) {
        ResponseBase<t_a_type> result = new ResponseBase<>();
        try {
        } catch (Exception e) {
            logger.error("新建文章分类", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 修改文章分类
     */
    @ApiOperation(value = "修改文章分类", notes = "修改文章分类")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Param", value = "文章分类信息", required = true, dataType = "t_a_type", paramType = "body")
    })
    @PostMapping("EditType")
    public ResponseBase EditType(@RequestBody t_a_type Param) {
        ResponseBase result = new ResponseBase();
        try {
        } catch (Exception e) {
            logger.error("修改文章分类", e);
            result.setStatue(0);
        }
        return result;
    }


    /**
     * 删除文章分类
     */
    @ApiOperation(value = "删除文章分类", notes = "删除文章分类")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Param", value = "文章分类删除参数", required = true, dataType = "DelArtileTypeRequest", paramType = "body")
    })
    @PostMapping("DelType")
    public ResponseBase DelType(@RequestBody DelArtileTypeRequest Param) {
        ResponseBase result = new ResponseBase();
        try {
        } catch (Exception e) {
            logger.error("修改文章分类", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 获取文章分类详细信息
     */
    @ApiOperation(value = "获取文章分类详细信息", notes = "获取文章分类详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "TypeID", value = "文章分类ID", required = true, dataType = "int", example = "0",defaultValue ="0" , paramType = "query")
    })
    @PostMapping("GetType")
    public ResponseBase GetType(@RequestParam int TypeID) {
        ResponseBase result = new ResponseBase();
        try {
        } catch (Exception e) {
            logger.error("获取文章分类详细信息", e);
            result.setStatue(0);
        }
        return result;
    }

}
